Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cleanup candidate_running.conf after it's loaded #2

Merged
merged 1 commit into from
Jun 21, 2023

Conversation

yzguy
Copy link

@yzguy yzguy commented Jun 21, 2023

When the rendered file is scp'd to the device, it's set to be owned by the user that did it, this makes it so if another users tries to do it, they get a permission denied error because they cannot overwrite the candidate_running.conf file.

fatal: [router1]: FAILED! => changed=false 
  msg: |-
    cannot load config: scp: /var/tmp/candidate_running.conf: Permission denied

This seems to be because the /var/tmp/candidate_running.conf file is left around from previous runs and has 644 permissions, only allowing the vyos user to write to it. This wouldn't become an issue if these files were cleaned up after the operation(s) are finished, which it seems the code as of now does not do that.

vyos@dev:~$ ls -la /var/tmp
total 20
drwxrwxrwt  6 root  root   180 Jun 11 16:50 .
drwxr-xr-x  1 root  
-rwxr-xr-x  1 vyos  users 1896 Jun 11 16:48 backup_running.conf
-rw-r--r--  1 vyos  users 1784 Jun 11 16:48 candidate_running.conf
-rw-r--r--  1 yzguy users  182 Jun 11 16:50 test.sh

This change removes this file after it's loaded into configure mode

Fixes napalm-automation-community#46

@yzguy yzguy merged commit 17c3590 into develop Jun 21, 2023
@yzguy yzguy deleted the yzguy/cleanup_candidate branch June 21, 2023 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

napalm-vyos does not clean up candidate_running or backup_running
2 participants